<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Cause extends Model
{
    protected $table = 'dd_cause';
    protected $primaryKey = 'id';
    public $timestamps = false;
    protected $guarded = array();
    
    /**
     * 添加原因
     */
    public static function addCause(\Illuminate\Http\Request $request) {
        $data = $request->all();
        $res = static::firstOrCreate($data);
        if ($res) {
            return ['status'=> 1, 'info'=> '添加成功'];
        } else {
            return ['status' => 0, 'info' => '添加失败'];
        }
    }
}
